package com.zcoj.wx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zcoj.wx.mapper.WxQrCodeMapper;
import com.zcoj.wx.pojo.WxQrCode;
import com.zcoj.wx.service.WxQrCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author chenbin
 * @version 1.0
 * @description: TODO
 * @date 2023/8/19 22:26
 */
@Service
public class WxQrCodeServiceImpl implements WxQrCodeService {

	@Autowired
	private WxQrCodeMapper wxQrCodeMapper;

	@Override
	public Integer insertWxQrCode(WxQrCode wxQrCode) {
		return wxQrCodeMapper.insert(wxQrCode);
	}

	@Override
	public WxQrCode getWxQrCodeByTicket(String ticket) {
		QueryWrapper<WxQrCode> wxQrCodeQueryWrapper=new QueryWrapper<>();
		wxQrCodeQueryWrapper.eq("ticket",ticket);
		return wxQrCodeMapper.selectOne(wxQrCodeQueryWrapper);
	}

	@Override
	public Integer updateWxQrCode(WxQrCode wxQrCode) {
		return wxQrCodeMapper.updateById(wxQrCode);
	}
}
